package com.tinem.platform.module.starter.jpa.repository.config;

import com.tinem.platform.module.starter.jpa.entity.config.ConfigWebFileClient;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * @program: platform
 * @description: ${description}
 * @author: eden#can
 * @Slogan: 没有所谓失败，除非你不再尝试
 * @date: 2021-12-11 17:45
 **/
@Repository
public interface ConfigWebFileClientRepository extends JpaRepository<ConfigWebFileClient,String> {

    /**
     * 更新渠道使用存储大小
     * @param clientId
     * @param size
     * @return
     */
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update t_config_web_file_client set c_chennel_use_storage_size = c_chennel_use_storage_size + :size where c_id = :clientId")
    int updateUseStorage(@Param("clientId") String clientId,@Param("size")  Long size);

}
